From 1a0a31cbc6f8e98e48c39eac42952b619cca591a Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 12 Dec 2007 10:08:14 +0000 Subject: [PATCH] xend: Fix cleanup_domains() for suspending managed domains When unmanaged domains with on_xend_stop="suspend" exist, managed domains are not suspended by xend stop command. The processing of cleanup_domains() is aborted by exception. This patch keeps suspending managed domains even if unmanaged domains exist. Signed-off-by: Masaki Kanno --- tools/python/xen/xend/XendDomain.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py index 5af454afd0..553a22d2c7 100644 --- a/tools/python/xen/xend/XendDomain.py +++ b/tools/python/xen/xend/XendDomain.py @@ -613,13 +613,19 @@ class XendDomain: if dom.getName() == DOM0_NAME: continue - if dom._stateGet() == DOM_STATE_RUNNING: - shutdownAction = dom.info.get('on_xend_stop', 'ignore') - if shutdownAction == 'shutdown': - log.debug('Shutting down domain: %s' % dom.getName()) - dom.shutdown("poweroff") - elif shutdownAction == 'suspend': - self.domain_suspend(dom.getName()) + try: + if dom._stateGet() == DOM_STATE_RUNNING: + shutdownAction = dom.info.get('on_xend_stop', 'ignore') + if shutdownAction == 'shutdown': + log.debug('Shutting down domain: %s' % dom.getName()) + dom.shutdown("poweroff") + elif shutdownAction == 'suspend': + self.domain_suspend(dom.getName()) + else: + log.debug('Domain %s continues to run.' % dom.getName()) + except: + log.exception('Domain %s failed to %s.' % \ + (dom.getName(), shutdownAction)) finally: self.domains_lock.release() -- 2.30.2